import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/manager/list',
    method: 'get',
    params: query
  })
}

export function fetchManager(id) {
  return request({
    url: '/manager/detail/' + id,
    method: 'get'
  })
}

export function createManager(data) {
  return request({
    url: '/manager/add',
    method: 'post',
    data
  })
}

export function updateManager(data) {
  return request({
    url: '/manager/update',
    method: 'post',
    data
  })
}

export function saveManager(data) {
  return request({
    url: '/manager/save',
    method: 'post',
    data
  })
}

export function deleteManager(id) {
  return request({
    url: '/manager/delete/'+id,
    method: 'post'
  })
}

export function login(data) {
  return request({
    url: '/manager/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/manager/info',
    method: 'get',
    params: { token }
  })
}
